package com.bw.module_service.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.bw.module_service.fragment.BojinFragment
import com.bw.module_service.fragment.HuangjinFragment
import com.bw.module_service.fragment.ZhuanshiFragment

class FragmentAdapter2(
    fragmentManager: FragmentManager,

    private val tabTitles: Array<String>
) : FragmentPagerAdapter(fragmentManager) {


    override fun getItem(position: Int): Fragment {
        return when (position) {
            0 -> HuangjinFragment()
            1 -> BojinFragment()
            2 -> ZhuanshiFragment()
            else -> throw IllegalArgumentException("Invalid position")
        }
    }

    override fun getCount(): Int {
        return tabTitles.size
    }



    override fun getPageTitle(position: Int): CharSequence? {
        return tabTitles[position]
    }


}